package sojo.com.inverter.enums;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;

/**
 * @author cheng_hu
 * @description:
 * @date 2023-02-23 19:09:32
 */
public enum TopicEnum {

    Alarm("AlarmDatasVo", "topic_alarm","deviceId"),
    InverterCommon("InverterCommon", "topic_inverter","inverterId");


    private String className; //类名
    private String topic; //topic主题
    private String deviceId; //设备id


    public static String getTopic(String className){
        if(StringUtils.isBlank(className)){
            return "";
        }
        for(TopicEnum topicEnum : TopicEnum.values() ){
            if(className.equals(topicEnum.getClassName())){
                return topicEnum.getTopic();
            }
        }
        return "";

    }


    public static String getDeviceIdName(String className){
        if(StringUtils.isBlank(className)){
            return "";
        }
        for(TopicEnum topicEnum : TopicEnum.values() ){
            if(className.equals(topicEnum.getClassName())){
                return topicEnum.getDeviceId();
            }
        }
        return "";
    }

    TopicEnum(String className, String topic, String deviceId) {
        this.className = className;
        this.topic = topic;
        this.deviceId = deviceId;
    }


    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }
}
